#ifndef CONNECTOR_THREAD_H
#define CONNECTOR_THREAD_H

#include <defs/export.h>
#include <defs/global.h>
#include "common.h"

#include <QtCore>

namespace Opl
{
    namespace Helpers
    {

        O_PRIVATE_DECLARE(ConnectorThread);
        class HELPERS_EXPORT ConnectorThread : public QThread
        {
                Q_OBJECT
            public:
                virtual ~ConnectorThread();

                static ConnectorThread* instance();

                void Setup (const ConnectorSetup& setup);
                void Send(const QString& data);

            signals:
                void connected();
                void disconnected();
                void error();

            public slots:
                void stop();

            private slots:
                void clientConnected();
                void clientDisconnected();
                void connectionError();

            protected:
                void run()Q_DECL_OVERRIDE;


            private:
                ConnectorThread(QObject* parent = 0);
                O_PRIVATE_DECLARE_MEMBER(ConnectorThread)
        };

    }
}

#endif // CONNECTOR_THREAD_H

